import java.util.ArrayList;

public class QueueRepository {

	private static QueueRepository repository;
	private static ArrayList<Queue> queues = new ArrayList<Queue>();

	private QueueRepository() {
	}

	public static QueueRepository getOrderRepository() {
		if (repository == null) {
			repository = new QueueRepository();
		}
		return repository;
	}

	public void addQueue(Queue queue) {
		queues.add(queue);
	}

	public ArrayList<Queue> getAllQueues() {
		return queues;
	}

	public Queue getQueue(int stockId) {
		for (int i = 0; i < queues.size(); i++) {
			Queue queue = queues.get(i);
			if (queue.getStockId() == stockId) {
				return queues.get(i);
			}
		}
		return null;
	}

}
